home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / jazlib.arc / JZWRITE.C < prev    next >
Text File  |  1988-12-18  |  1KB  |  54 lines

  1. extern int _row1,_row2,_col1,_col2,_attr,g_row,g_col,g_fore,g_back;
  2. jzwrite ( fstr )
  3. char *fstr;
  4. {
  5.   int w,wscrseg,wndofs,wrow,wcol,wstart,wend;
  6.  
  7.   jzgetcur(&wrow,&wcol,&wstart,&wend);
  8.  
  9.   while (*fstr) {
  10.     #if DEBUG
  11.       int wi;
  12.       printf("\n%d %d %d %d %d %d",_row1,_col1,_row2,_col2,g_row,g_col);
  13.       for (wi = 0 ; wi < 255 ; wi ++)     ;  /* do nothing pointer */
  14.       printf("\n%d %d",wrow,wcol);
  15.     #endif
  16.  
  17.     switch(*fstr) {
  18.       case '\b' :
  19.     wcol --;
  20.     fstr++;
  21.     break;
  22.       case '\n' :
  23.     wcol = _col2 + 1;    /* force new line condition */
  24.     fstr++;
  25.     break;
  26.       case '\r' :
  27.     wcol = _col1; /* back to column 1 */
  28.     fstr++;
  29.     break;
  30.       case '\t' :
  31.     do ; while(++wcol % 8);
  32.     fstr++;
  33.     break;
  34.     }
  35.  
  36.     if (wcol > _col2) {
  37.       wcol = _col1;
  38.       if (wrow == _row2)
  39.     jzscrlup(_row1 << 8 | _col1,_row2 << 8 | _col2,1,_attr);
  40.       else
  41.     ++ wrow;
  42.     }
  43.  
  44.     jzloccur(wrow,wcol);
  45.     if (*fstr) {
  46.       jzwrtchr(*fstr++,_attr,1);
  47.       ++ wcol;
  48.     }
  49.  
  50.   }
  51.   g_row=wrow;
  52.   g_col=wcol;
  53. }
  54.